<template id='AmapDialog'>
  <div class="AmapDialog">
    <div class="head">
      <div class="windowIcon"></div>
      <p class="title">{{ showData.title }}</p>
      <div class="closeButton" @click="closeDialog"></div>
    </div>
    <div class="body">
      <div
        class="detailItem"
        v-for="(item, index) in showData.detail"
        :key="index"
      >
        <div class="itemName">{{ item.name }}</div>
        <div class="itemText">{{ item.text }}</div>
      </div>
    </div>
    <div class="foot" @click="footFunction">{{ showData.buttonText }}</div>
  </div>
</template>

<script>
// 这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）1

export default {
  name: "AmapDialog",
  components: {},
  // 定义属性
  data() {
    return {};
  },
  props: {
    showData: {
      type: Object,
      default: function () {
        return {};
      },
    },
  },
  // 计算属性，会监听依赖属性值随之变化
  computed: {},
  // 监控data中的数据变化
  watch: {},
  // 方法集合
  methods: {
    closeDialog() {
      this.$emit("closeDialog", false);
    },
    footFunction() {
      this.$emit("dialogFunction", {
        name: this.showData.functionName,
        id: this.showData.id,
      });
    },
  },
  // 生命周期 - 创建完成（可以访问当前this实例）
  created() {},
  // 生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
  beforeCreate() {}, // 生命周期 - 创建之前
  beforeMount() {}, // 生命周期 - 挂载之前
  beforeUpdate() {}, // 生命周期 - 更新之前
  updated() {}, // 生命周期 - 更新之后
  beforeDestroy() {}, // 生命周期 - 销毁之前
  destroyed() {}, // 生命周期 - 销毁完成
  activated() {}, // 如果页面有keep-alive缓存功能，这个函数会触发
};
</script>

<style lang='scss' scoped>
.AmapDialog {
  width: 16vw;
  background-image: linear-gradient(
    90deg,
    rgba(3, 83, 165, 0.72) 0%,
    rgba(3, 56, 117, 0.93) 61%,
    rgba(3, 53, 110, 0.96) 100%
  );
  box-shadow: 0vw 0.13vw 0.52vw 0vw rgba(0, 0, 0, 0.26);
  border-radius: 0.21vw;
  border: solid 0.05vw #34a1ff;
  .head {
    height: 1.01vw;
    display: flex;
    align-items: center;
    padding: 0.5vw;
    border-bottom: 0.03vw solid #03d0fd;
    .windowIcon {
      background: url("../../../../../../../assets/images/indexBody/amapDialog/windowIcon.png");
      background-size: 100% 100%;
      width: 0.73vw;
      height: 0.6vw;
    }
    .title {
      font-size: 0.63vw;
      color: #03f2fb;
      margin: 0 auto 0 0.44vw;
      user-select: none;
    }
    .closeButton {
      background: url("../../../../../../../assets/images/indexBody/amapDialog/closeButton.png");
      background-size: 100% 100%;
      width: 0.52vw;
      height: 0.52vw;
      cursor: pointer;
    }
  }
  .body {
    padding: 0.5vw;
    .detailItem {
      display: flex;
      font-size: 0.52vw;
      margin: 0.85vw 0;
      .itemName {
        color: #ffffff;
        width: 35%;
      }
      .itemText {
        color: #03f2fb;
        margin-left: 1.46vw;
      }
    }
  }
  .foot {
    background: url("../../../../../../../assets/images/indexBody/amapDialog/buttonStyle.png");
    background-size: 100% 100%;
    width: 2.6vw;
    height: 1.04vw;
    font-size: 0.52vw;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    cursor: pointer;
    margin-bottom: 0.5vw;
  }
  .foot:hover {
    color: #03f2fb;
  }
}
</style>